#include"mythread.hpp"
#include <memory>


void* thread_run(void* args)
{
    std::string work_type = static_cast<const char*>(args);
    while(1)
    {
        std::cout << "i'm new thread, i'm doing：" << work_type << std::endl;
        sleep(1);
    }
}


int main()
{
    // 线程被创建出来就会跑起来
    std::unique_ptr<Thread> thread1(new Thread(thread_run, (void*)"working", 1));
    std::unique_ptr<Thread> thread2(new Thread(thread_run, (void*)"cooking", 2));
    std::unique_ptr<Thread> thread3(new Thread(thread_run, (void*)"running", 3));

    thread1->join();
    thread2->join();
    thread3->join();

    return 0;
}